<include file="Public/header"/>
<body class="body-bg">
<div class="park-header">
    <form class="park-search-group" method="get" action="/Home/Index/goods_list/">
        <div class="park-search-input">
            <input type="text" name="keywords" placeholder="请输入商品名进行搜索">
        </div>
        <div class="park-search-cancel" onclick="window.history.back();">取消</div>
    </form>
</div>
<div class="container">
    <div class="park-search-hot">
        <div class="park-search-hot__title">热门搜索</div>
        <div class="park-search-hot-list">
            <volist name="hot_list" id="val">
            <div class="park-search-hot-item" onclick="search_detail('{$val}');">
                <span class="park-search-hot-item__text">{$val}</span>
            </div>
            </volist>
        </div>
    </div>
    <div class="park-search-history">
        <div class="park-search-history__title">历史搜索</div>
        <div class="park-search-history-list">
            <volist name="history" id="val">
            <div class="park-search-history-item">
                <span class="park-search-history-item__text" onclick="search_detail('{$val.title}');">{$val.title}</span>
                <span class="park-search-history-item__cancel">
                    <i class="iconfont icon-cuowu"></i>
                </span>
            </div>
            </volist>
        </div>
        <div class="park-search-history__clear" onClick="clear_history(this);">清空历史搜索记录</div>
    </div>
</div>
</body>
<script src="__ROOT__/Public/Home/layer/layer.js"></script>
<script>
    function search_detail(name){
        window.location = '/Home/Index/goods_list/keywords/'+name;
    }
	function clear_history(obj){
		layer.open({
            content: '您确定要清空历史吗？'
            ,btn: ['确定','取消']
            ,yes: function(index){
                $.post('/Home/Index/clear_history/',{},function(data){
                    if(data.code==200){
						$(obj).prev().html('');
						layer.closeAll();
                    }
                },'json');
            }
        });
	}
</script>
</html>